<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<html>

	<head>

		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

		<title>仪器共享</title>

		<meta name="keywords" content="科研仪器，生命科学仪器，环境检测仪器，实验常用设备，分析仪器">

		<meta name="description" content="中国领先的科研仪器共享平台，让您快速找到各种类型的科学研究仪器。提升闲置仪器利用率，产生更大科研价值。涵盖：生命科学仪器、环境检测仪器、实验常用设备、分析仪器、仪表、物性测试、测量/计量仪器、在线及过程控制仪器。

">
		<!-- <link rel="stylesheet" href="new_css/header_footer.css?t=1"> -->
		<link rel="stylesheet" href="new_css/publishService.css">
		<script src="new_js/jquery-1.11.3.js"></script>
		<script>
			$(function() {
				$('#front_header .header_wrap .right').hover(function() {
					$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon2.png');
					$('#front_header .header_wrap .right .out').show();
				}, function() {
					$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon1.png');
					$('#front_header .header_wrap .right .out').hide();
				});
				$('#sorts').on('mouseover', 'li', function() {
					$(this).find('span img').attr('src', 'images/icon4.png');
				});
				$('#sorts').on('mouseout', 'li', function() {
					$(this).find('span img').attr('src', 'images/icon5.png');
				});

				$('.mainList .content .left li').click(function() {
					$(this).addClass('selected').siblings().removeClass('selected');
				});
			});
			
		</script>

	</head>

	<body style="background:#fff;">
	<%@include file="/header4.jsp"%>
		<div class="mainList">
			<div class="bNav">您的位置：仪器管理与分布><span id="titleSpan1">发布服务</span></div>
			<div class="content">
				<div class="right">
					<div class="title"><span id="titleSpan2">发布服务</span></div>
					<ul>
						<li>
							<label>服务名称</label>
							<input type="text" name="" id="name" value="" />
						</li>
						
						<li>
							<label>服务机构</label>
							<input type="text" name="" id="agency" value="" />
						</li>
						
						<li>
							<label id="picLabel">添加图片</label>

								
									<input type="file" id="addImg" value=""  onchange="selectImage(this);" /><br/>

						</li>
						
						<li class="item4">
							<label>服务内容</label>
							<textarea id="content"></textarea>
						</li>
						
						<li>
							<label>服务收费</label>
							<input type="text" name="" id="fee" value="" style="width:21%" />
							<span>&nbsp;&nbsp;单位&nbsp;</span>
							<input type="text" name="" id="unit" value="" style="width:11%" />
						</li>
						<li>
							<label>联系人</label>
							<input type="text" name="" id="contacts" value="" />
						</li>
						<li>
							<label>联系电话</label>
							<input type="text" name="" id="mobile" value="" />
						</li>
						<li>

	<style>








	.wrap {
	width: 100%;
	}

	.h20 {
	height: 20px;
	overflow: hidden;
	clear: both;
	}

	.nice-select {

	width: 128px;
	padding: 0 10px;
	height: 46px;
	margin-left: 7px;
	display: inline-block;
	border-radius: 5px;
	border: 1px solid #ccc;
	position: relative;
	background: #fff url(images/icon.png) no-repeat right center;

	}

	.nice-select input {
	display: block;
	width: 100%;
	height: 38px;
	line-height: 38px \9;
	border: 0;
	outline: 0;
	background: none;
	}

	.nice-select ul {

	width: 100%;
	display: none;
	position: absolute;
	left: -1px;
	top: 38px;
	overflow: hidden;
	background-color: #fff;
	max-height: 150px;
	overflow-y: auto;
	border: 1px solid #ccc;
	border-top: 0;
	/* box-shadow: 0 3px 5px #999; */
	z-index: 9999;

	}

	.nice-select ul li {
	height: 30px;
	line-height: 30px;
	overflow: hidden;
	padding: 0 10px;
	cursor: pointer;
	}

	.nice-select ul li.on {
	background-color: #e0e0e0;
	}

	</style>
							<label style="float: left;">地址</label>
							<%--<input type="text" name="" id="address" value="" />--%>
								<div class="nice-select" name="nice-select">
								<input type="text" value="省" id="province" readonly style="border: 0px;">
									<ul id="provinceUl">
									</ul>
								</div>

								<div class="nice-select" name="nice-select">
								<input type="text" value="市" id="city" readonly style="border: 0px;">
								<ul id="cityUl">
								</ul>
								</div>

								<div class="nice-select" name="nice-select">
								<input type="text" value="区" id="county" readonly style="border: 0px;">
								<ul id="countyUl">
								</ul>
								</div>

						</li>

						<li>
							<label></label>
							<input type="text" name="" id="address" value="" placeholder="请您输入您的详细地址...">
						</li>
						<li>
							<label>服务结果获取时间</label>
							<input type="text" name="" id="getTime" value="" placeholder="单位为天"/>
						</li>
						<li class="item10">
							<label><span>*</span>有效时间</label>
							<!-- <select>
								<option>2018-4-9</option>
							</select> -->
							<input type="date" name="" id="startTime" value="" style="width: 200px;"/>
							<span>到</span>
							<input type="date" name="" id="endTime" value="" style="width: 200px;"/>
							<!-- <select>
								<option>2018-4-9</option>
							</select> -->
							
						</li>
						<!-- <li>
							<label>发布人</label>
							<input type="text" name="" id="" value="" />
						</li> -->
						<li class="item11">
							<label>添加使用仪器</label>
							<select id="insList">
								<option value="null">请选择仪器</option>
							</select>
							
						</li>
						<li>
						<table id="insTable" style="display:none;" >
									<tr id="firstTr">
										<th>序号</th>
										<th>仪器名称</th>
										<th>数量</th>
										<th>预算费用</th>
										<th>样品要求</th>
										<th>删除</th>
									</tr>
									<!-- <tr>
										<td>1</td>
										<td>元素测定</td>
										<td>1</td>
										<td>150</td>
										<td></td>
										<td></td>
									</tr> -->
									
								</table>
						</li>
						<div style="
    width: 1200px;
    margin-left: 183px;
    float: left;
    margin-top: 30px;
"><a id="sub">发布</a></div>
<style>
	a#sub {
    width: 196px;
    height: 62px;
    text-align: center;
    line-height: 62px;
    background: #ff8a00;
    border: none;
    color: #fff;
    display: inline-block;
    justify-content: end;
    align-items: end;
    text-align: center;
    margin-bottom: 30px;
    font-size: 26px;
    border-radius: 8px;
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
}
table#insTable {
    margin-left: 182PX;
}
</style>
			</div>
					</ul>
					
					
				</div>
			<div class="pageButton"></div>
			<!--找个分页插件插入-->
		</div>

		<%@include file="/footer.jsp"%>
	<script>
			var provinceCode="";
			var cityCode="";
			var countyCode="";
			var returnProvince="";
			var returnCity="";
			var returnCounty="";
			var delImg="";
			$(function() {
					liClick();
					//flag:1省,2市,3县
					listCity(0,1);
					$.ajax({
							type: 'GET',
							url:Server + "/serviceRelevant/listInsByUid",
							//url:"http://localhost/serviceRelevant/listInsByUid",
							//url:"http://localhost:8080/share_ins/serviceRelevant/listInsByUid",
							dataType: 'json',
							data: {
								//"uid": "23",
								"uid":$("#useridoflogin").val()
							},
							success: function(data) {
								for(var i = 0;i<data.length;i++){
							   		$("#insList").append("<option value="+data[i].id+" price="+data[i].total+" sample="+data[i].sampleRequired+">"+data[i].chineseName+"</option>")
							   }
							   $("#insList").change(function() {
									if($('#insList option:selected').val()!="null"){
										for (var i=0;i<$('tr').length-1;i++){
											var $tr=$('tr').eq(i+1);
											if($tr.children().eq(5).children().eq(0).val()==$('#insList option:selected').val()){
												alert("您已添加该仪器");
												return false;
											}
										}
										$("#insTable").append("<tr>\
										<td></td>\
										<td>"+$("#insList option:selected").text()+"</td>\
										<td>1</td>\
										<td>"+$("#insList option:selected").attr("price")+"</td>\
										<td>"+$("#insList option:selected").attr("sample")+"</td>\
										<td><input type='hidden' value="+$('#insList option:selected').val()+"><img class='delIns' src='images/delete.png'</img></td>\
										</tr>");
										if($('tr').length>1){
											$("#insTable").css('display','block');
										} 
										for (var i=0;i<$('tr').length-1;i++){
											var $tr=$('tr').eq(i+1);
											$tr.children().eq(0).text(i+1);
										}
										$('.delIns').click(function() {
											$(this).parent().parent().remove();
											for (var i=0;i<$('tr').length-1;i++){
												var $tr=$('tr').eq(i+1);
												$tr.children().eq(0).text(i+1);
											}
											if($('tr').length<=1){
												$("#insTable").css('display','none');
											}
										});
									}
								});
							},
							error: function() {
								alert("获取仪器列表失败！！");
							}
						});
					
					function GetUrlByParamName(name) {
			  			 var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
			 			 var URL =  decodeURI(window.location.search);
			  			 var r = URL.substr(1).match(reg);
			 			 if(r!=null){
			 		        //decodeURI() 函数可对 encodeURI() 函数编码过的 URI 进行解码
			 		         return decodeURI(r[2]);
			  			 };
			  		     return null;
			 		};
			 		
					if(GetUrlByParamName("serviceId")!=null){
						$.ajax({
							type: 'GET',
							url:Server + "/serviceRelevant/publishServiceDetail",
							//url:"http://localhost/serviceRelevant/publishServiceDetail",
							//url:"http://localhost:8080/share_ins/serviceRelevant/publishServiceDetail",
							dataType: 'json',
							data: {
								"serviceId":GetUrlByParamName("serviceId")
							},
							success: function(data) {
								$("#name").val(data.serviceName);
								$("#agency").val(data.serviceAgency);
								$("#content").val(data.serviceContent);
								$("#fee").val(data.serviceFee);
								$("#unit").val(data.unit);
								$("#contacts").val(data.contacts);
								$("#mobile").val(data.mobile);
								$("#titleSpan1").text(data.serviceName);
								$("#titleSpan2").text(data.serviceName);
								returnProvince=data.province;
								returnCity=data.city;
								returnCounty=data.county;
								provinceCode=data.province;
								cityCode=data.city;
								countyCode=data.county;
								listCity(data.province,2);
								listCity(data.city,3);
								$("#address").val(data.address);
								$("#getTime").val(data.getTime);
								$("#startTime").val(new Date(data.startTime).Format("yyyy-MM-dd"));
								$("#endTime").val(new Date(data.endTime).Format("yyyy-MM-dd"));
								if(data.sinsDetails.length>0){
									var html="";
									for(var i=0;i<data.sinsDetails.length;i++){
										html=html+"<tr>\
										<td></td>\
										<td>"+data.sinsDetails[i].chineseName+"</td>\
										<td>1</td>\
										<td>"+data.sinsDetails[i].price+"</td>\
										<td>"+data.sinsDetails[i].sampleRequired+"</td>\
										<td><input type='hidden' value="+data.sinsDetails[i].insId+"><img class='delIns' src='images/delete.png'</img></td>\
										</tr>";
									}
									$("#insTable").css('display','block');
									$("#insTable").append(html)
									for (var i=0;i<$('tr').length-1;i++){
										var $tr=$('tr').eq(i+1);
										$tr.children().eq(0).text(i+1);
									}
									if(GetUrlByParamName("modify")=="true"){
										$('.delIns').click(function() {
											$(this).parent().parent().remove();
											for (var i=0;i<$('tr').length-1;i++){
												var $tr=$('tr').eq(i+1);
												$tr.children().eq(0).text(i+1);
											}
											if($('tr').length<=1){
												$("#insTable").css('display','none');
											}
										}); 
									}
								}
								if(GetUrlByParamName("modify")=="false"){
									$(".delIns").each(function() {
										$(this).parent().hide();
									});
									$("#firstTr").children().eq(5).remove();
									$("#picLabel").text("图片")
								}
								var paths=new Array();
								paths.push(data.ssimagelist[0].imagePath);
								var flag=false;
								for (var i=0;i<data.ssimagelist.length;i++){
									for(var j=0;j<paths.length;j++){
										if(paths[j]==data.ssimagelist[i].imagePath){
											flag=false;
											break;
										}else{
											flag=true;
										}
									}
									if(flag==true){
										paths.push(data.ssimagelist[i].imagePath);
										flag=false;
									}
								} 
								if(GetUrlByParamName("modify")=="false"){
									for(var i=0;i<paths.length;i++){
										$("#addImg").parent().append("<div class='dsgfigdsibf'><img class='uploadImg' width='140px' src='"+paths[i]+"'</img></div>");
									}
								$("#addImg").hide()
								}else if(GetUrlByParamName("modify")=="true"){
									for(var i=0;i<paths.length;i++){
										$("#addImg").parent().append("<div class='dsgfigdsibf'><img class='uploadImg' width='140px' src='"+paths[i]+"'</img><img class='delete' src='images/delete.png'</img></div>");
									}
									/* $('.delete').click(function() {
										$(this).parent().remove();
									});	
									$('.delete').unbind(); */
									$('.delete').click(function() {
										if($(this).prev().attr("src").substring(0,4)!="data"){
											delImg=delImg+$(this).prev().attr("src")+"@";
										}
										$(this).parent().remove();
									});	
								}
								
							},
							error: function() {
							}
						}); 
						if(GetUrlByParamName("modify")=="false"){
							$("#sub").remove();
							$('input').attr("readonly","readonly")
							$('textarea').attr("readonly","readonly")
							$('select').attr("disabled",true)
						}else if(GetUrlByParamName("modify")=="true"){
							$("#sub").text("保存");
							$("#sub").click(function() {
								//alert("provinceCode:"+provinceCode+","+"cityCode:"+cityCode+","+"countyCode:"+countyCode)
								if($("#province").val()=="台湾省"||$("#province").val()=="香港特别行政区"||$("#province").val()=="澳门特别行政区"){
									cityCode=provinceCode;
									countyCode=provinceCode;
								}else{
									if($("#province").val()=="省"||$("#city").val()=="市"||$("#county").val()=="区"){
										alert("请选择完整的地址");
										return;
									}
								}
								var start=$("#startTime").val();
								var end=$("#endTime").val();
								if(start>end){
									alert("起始时间不可超过结束时间");
									return;
								}
								var insStr="";
								for (var i=0;i<$('tr').length-1;i++){
									var $tr=$('tr').eq(i+1);
									insStr=insStr+$tr.children().eq(5).children().eq(0).val()+",";
								}
								if(insStr==""){
									alert("请选择使用仪器")
									return;
								}
								//alert(insStr);
								var imgStr="";
								var $images=$(".uploadImg");
								for(var j=0;j<$(".uploadImg").length;j++){
									if($(".uploadImg").eq(j).attr("src").substring(0,4)=="data"){
										imgStr=imgStr+$(".uploadImg").eq(j).attr("src")+"@";
									}
								}
								//alert(imgStr)
								/* if(imgStr==""){
									alert("请选择图片");
									return;
								} */
								delImg=delImg.substring(0,delImg.length-1);
								$.ajax({
									type: "POST",
									async:false, 
									url:Server + "/serviceRelevant/updateService",
									//url:"http://localhost/serviceRelevant/updateService",
									//url:"http://localhost:8080/share_ins/serviceRelevant/updateService",
									data:{
										"serviceId":GetUrlByParamName("serviceId"),
										"name": $("#name").val(),
										"agency" : $("#agency").val(),
										"fee" : $("#fee").val(),
										"unit" : $("#unit").val(),
										"content" : $("#content").val(),
										"contacts" : $("#contacts").val(),
										"mobile":$("#mobile").val(),
										"province":provinceCode,
										"city":cityCode,
										"county":countyCode,
										"address":$("#address").val(),
										"getTime":$("#getTime").val(),
										"startTime":$("#startTime").val(),
										"endTime":$("#endTime").val(),
										"instruments":insStr,
										//"uid":"4d272484d5844be693c05443c4edd71e"
										"uid":$("#useridoflogin").val()
									},
									//dataType: 'json',
									success: function(data) {
										//alert(JSON.stringify(data));
										alert(data);
										$.ajax({
										async:false, 
										type: 'POST',
										//url:'http://localhost/serviceRelevant/serviceImgUpload',
										url:Server+"/serviceRelevant/serviceImgUpload",
										//url:'http://localhost:8080/share_ins/serviceRelevant/serviceImgUpload',
										data: {
											"images": imgStr,
											"delImg": delImg,
											"serviceId":GetUrlByParamName("serviceId")
										},
										dataType: 'json',
										success: function(data) {
											//alert("提交成功！！");
											//var rejecturl = "new_file35";
											//window.location.replace(rejecturl);
											window.location.href="Service_list";
										},
										error: function() {
											window.location.href="Service_list";
										}
									}); 
									},
									error: function() {
										alert("失败");
										$.ajax({
										type: 'POST',
										//url:'http://localhost/serviceRelevant/serviceImgUpload',
										url:Server+"/serviceRelevant/serviceImgUpload",
										data: {
											"images": imgStr,
											"delImg": delImg,
											"serviceId":GetUrlByParamName("serviceId")
										},
										dataType: 'json',
										success: function(data) {
											//alert("提交成功！！");
											//var rejecturl = "new_file35";
											//window.location.replace(rejecturl);
											window.location.href="Service_list";
										}
									}); 
									}
								});   
							});	
						}
					}else if(GetUrlByParamName("serviceId")==null){
						$.ajax({
							type: 'GET',
							url:Server + "/serviceRelevant/getContactInfo",
							//url:"http://localhost/serviceRelevant/getContactInfo",
							//url:"http://localhost:8080/share_ins/serviceRelevant/getContactInfo",
							dataType: 'json',
							data: {
								"uid":$("#useridoflogin").val()
								//"uid":"4d272484d5844be693c05443c4edd71e"
							},
							success: function(data) {
								$("#contacts").val(data.realname);
								$("#mobile").val(data.phone);
							},
							error: function() {
							}
						});
						$("#sub").click(function() {
						//alert("provinceCode:"+provinceCode+","+"cityCode:"+cityCode+","+"countyCode:"+countyCode)
						if($("#province").val()=="台湾省"||$("#province").val()=="香港特别行政区"||$("#province").val()=="澳门特别行政区"){
							cityCode=provinceCode;
							countyCode=provinceCode;
						}else{
							if($("#province").val()=="省"||$("#city").val()=="市"||$("#county").val()=="区"){
								alert("请选择完整的地址");
								return;
							}
						}
						var start=$("#startTime").val();
						var end=$("#endTime").val();
						if(start>end){
							alert("起始时间不可超过结束时间");
							return;
						}
						var insStr="";
						for (var i=0;i<$('tr').length-1;i++){
							var $tr=$('tr').eq(i+1);
							insStr=insStr+$tr.children().eq(5).children().eq(0).val()+",";
						}
						if(insStr==""){
							alert("请选择使用仪器")
							return;
						}
						//alert(insStr);
						var imgStr="";
						var $images=$(".uploadImg");
						for(var j=0;j<$(".uploadImg").length;j++){
							imgStr=imgStr+$(".uploadImg").eq(j).attr("src")+"@";
						}
						//alert(imgStr);
						if(imgStr==""){
							alert("请选择图片");
							return;
						}
						$.ajax({
							type: "POST",
							async:false, 
							url:Server + "/serviceRelevant/publishService",
							//url:"http://localhost/serviceRelevant/publishService",
							//url:"http://localhost:8080/share_ins/serviceRelevant/publishService",
							data:{
								"name": $("#name").val(),
								"agency" : $("#agency").val(),
								"fee" : $("#fee").val(),
								"unit" : $("#unit").val(),
								"content" : $("#content").val(),
								"contacts" : $("#contacts").val(),
								"mobile":$("#mobile").val(),
								"province":provinceCode,
								"city":cityCode,
								"county":countyCode,
								"address":$("#address").val(),
								"getTime":$("#getTime").val(),
								"startTime":$("#startTime").val(),
								"endTime":$("#endTime").val(),
								"instruments":insStr,
								"uid":$("#useridoflogin").val()
								//"uid":"4d272484d5844be693c05443c4edd71e"
							},
							//dataType: 'json',
							success: function(data) {
								//alert(JSON.stringify(data));
								alert(data);
								$.ajax({
								async:false, 
								type: 'POST',
								//url:'http://localhost/serviceRelevant/serviceImgUpload',
								url:Server+"/serviceRelevant/serviceImgUpload",
								//url:'http://localhost:8080/share_ins/serviceRelevant/serviceImgUpload',
								data: {
									"images": imgStr,
									"uId": $("#useridoflogin").val(),
								},
								dataType: 'json',
								success: function(data) {
									//alert("提交成功！！");
									//var rejecturl = "new_file35";
									//window.location.replace(rejecturl);
									window.location.href="Service_list";
								},
								error: function() {
									window.location.href="Service_list";
								}
							}); 
							},
							error: function() {
								alert("失败");
								$.ajax({
								type: 'POST',
								//url:'http://localhost/serviceRelevant/serviceImgUpload',
								url:Server+"/serviceRelevant/serviceImgUpload",
								data: {
									"images": imgStr,
									"uId": $("#useridoflogin").val(),
								},
								dataType: 'json',
								success: function(data) {
									//alert("提交成功！！");
									//var rejecturl = "new_file35";
									//window.location.replace(rejecturl);
									window.location.href="Service_list";
								}
							}); 
							}
						}); 
					});
					}
						
							
					
				});
				
				function listCity(pid,flag){
					$.ajax({
							type: 'GET',
							url:Server + "/serviceRelevant/listCity",
							//url:"http://localhost/serviceRelevant/listCity",
							//url:"http://localhost:8080/share_ins/serviceRelevant/listCity",
							dataType: 'json',
							data: {
								"pid": pid,
							},
							success: function(data) {
								if(flag==1){
									var html="";
									for(var i = 0;i<data.length;i++){
										var li="<li class='provinceLi' value="+data[i].cityId+">"+data[i].cityName+"</li>";
										html=html+li;
							  	 	}
							  	 	$("#provinceUl").html(html);
							  	 	liClick(2);
								}else if(flag==2){
									var html="";
									for(var i = 0;i<data.length;i++){
							   			var li="<li class='cityLi' value="+data[i].cityId+">"+data[i].cityName+"</li>";
										html=html+li;
							  	 	}
							  	 	$("#cityUl").html(html);
							  	 	liClick(3);
								}else if(flag==3){
									var html="";
									for(var i = 0;i<data.length;i++){
										var li="<li class='countyLi' value="+data[i].cityId+">"+data[i].cityName+"</li>";
										html=html+li;
							  	 	}
							  	 	$("#countyUl").html(html);
							  	 	liClick();
								}
								function GetUrlByParamName(name) {
						  			 var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
						 			 var URL =  decodeURI(window.location.search);
						  			 var r = URL.substr(1).match(reg);
						 			 if(r!=null){
						 		        //decodeURI() 函数可对 encodeURI() 函数编码过的 URI 进行解码
						 		         return decodeURI(r[2]);
						  			 };
						  		     return null;
						 		};
								if(GetUrlByParamName("serviceId")!=null){
									if(flag==1){
										$(".provinceLi").each(function() {
											if($(this).val()==returnProvince){
												$("#province").val($(this).text());
											}
										});
									}else if(flag==2){
										$(".cityLi").each(function() {
											if($(this).val()==returnCity){
												$("#city").val($(this).text());
											}
										});
									}else if(flag==3){
										$(".countyLi").each(function() {
											if($(this).val()==returnCounty){
												$("#county").val($(this).text());
											}
										});
									}
								}
							},
							error: function() {
								alert("获取地址列表失败！！");
							}
					});
				}
				
				function liClick(flag){
					function GetUrlByParamName(name) {
						  			 var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
						 			 var URL =  decodeURI(window.location.search);
						  			 var r = URL.substr(1).match(reg);
						 			 if(r!=null){
						 		        //decodeURI() 函数可对 encodeURI() 函数编码过的 URI 进行解码
						 		         return decodeURI(r[2]);
						  			 };
						  		     return null;
						 		};
						 		
					if(GetUrlByParamName("modify")=="true"||GetUrlByParamName("modify")==null){
						$('[name="nice-select"]').click(function (e) {
						
							$('[name="nice-select"]').find('ul').hide();
					
						$(this).find('ul').show();
					
						e.stopPropagation();
					});
					}
				 
					$('[name="nice-select"] li').hover(function (e) {
				
					$(this).toggleClass('on');
				
					e.stopPropagation();
				
					});
				
					$('[name="nice-select"] li').click(function (e) {
				
					var val = $(this).text();
				
					$(this).parents('[name="nice-select"]').find('input').val(val);
					if(flag!=null){
						listCity($(this).val(),flag);
						if(flag==3){
							$("#county").val("区");
							$("#countyUl").html("");
							cityCode=$(this).val();
						}else if(flag==2){
							$("#city").val("市");
							$("#county").val("区");
							$("#cityUl").html("");
							$("#countyUl").html("");
							provinceCode=$(this).val();
						}
					}else{
						countyCode=$(this).val();
						//alert("provinceCode:"+provinceCode+","+"cityCode:"+cityCode+","+"countyCode:"+countyCode)
					}
				
					$('[name="nice-select"] ul').hide();
				
					e.stopPropagation();
				
					});
				
					 $(document).click(function () {
				
					$('[name="nice-select"] ul').hide();
				
					}); 
						
					}
				
				function selectImage(file) {
						if(!file.files || !file.files[0]) {
							return;
						}
						if(!/.(jpg|jpeg|JPG)$/.test(file.value)){
     					  alert("图片必须为jpg格式");
    				        return false;
     					 }
						var reader = new FileReader();
						reader.onload = function(evt) {
							//document.getElementById('image').src = evt.target.result;
							var addImg=document.getElementById("addImg");
							if(evt.target.result!=null){
								//alert(evt.target.result);
								var imgDiv="<div class='dsgfigdsibf'><img class='uploadImg' width='140px' src='"+evt.target.result+"'</img><img class='delete' src='images/delete.png'</img></div>";
								$("#addImg").parent().append(imgDiv);
							}
							$('.delete').click(function() {
								$(this).parent().remove();
							});	
						}
					reader.readAsDataURL(file.files[0]);
				}
				
				
		Date.prototype.Format = function (fmt) { //author: meizz 
			    var o = {
			        "M+": this.getMonth() + 1, //月份 
			        "d+": this.getDate(), //日 
			        "h+": this.getHours(), //小时 
			        "m+": this.getMinutes(), //分 
			        "s+": this.getSeconds(), //秒 
			        "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
			        "S": this.getMilliseconds() //毫秒 
			    };
			    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
			    for (var k in o)
			    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
			    return fmt;
			}

	</script>



	<style>
	.mainList .content .right ul li label {
		width: 158px;
		display: inline-block;
		text-align: right;
		padding-right: 20px;
	}

	.mainList .content .right .title {
		width: 100%;
		height: 47px;
		border-bottom: 1px solid #d3d3d3;
		line-height: 44px;
		font-size: 18px;
		color: #202020;
		margin-bottom: 35px;
	}

	textarea#content {
		width: 476px;
		border: 1px solid #ccc !important;
	}

	select#insList {
		width: 477px;
		border: 1px solid #ccc;
	}

	.mainList .content {
		width: 100%;
		height: 100%;
		padding-bottom: 20px;
	}
	th {
    width: 150px;
}

/* 	a#sub{
		width: 196px;
    height: 62px;
    text-align: center;
    line-height: 62px;
    background: #ff8a00;
    border: none;
    color: #fff;
    display: block;
    margin-bottom: 30px;
    font-size: 26px;
    border-radius: 8px;
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
    margin-left: 176px;
    margin-top: 20px;
	}
 */
	<%--img.uploadImg {--%>
		<%--display: inline-flex;--%>
		<%--justify-content: center;--%>
		<%--align-items: center;--%>
		<%--margin-left: 20px;--%>
	<%--}--%>

	<%--input#addImg {--%>
	<%--margin-left: 184px;--%>
	<%--}--%>


	.dsgfigdsibf {
		width: 140px;
		height: auto;
		border: 1px solid #ccc;
		margin-left: 184px;
		display: inline-block;
	}
	<%----%>
	
	.mainList .content .right {
    width: 1196px;
     float: right;
    height: 100%;
    /* padding: 0 20px; */
    border: 1px solid #d3d3d3;
}
.mainList .content .right {
    width: 1158px;
    float: right;
    height: 100%;
    /* padding: 0 20px; */
    border: 1px solid #d3d3d3;
}


	</style>

	<script>


	
	</script>
	</body>

</html>
